package com.shop2cn.iapi.shenqisettlement.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

/**
 * 根据国家获取汇率Call FreeMaker Template自动生成代码
 */
public class SaveGoodsOwnerPaymentCall extends YmatouBaseCall {
	private static String opurl = "/api/saveGoodsOwnerPayment";

	public SaveGoodsOwnerPaymentCall() {
		super(EnvSetup.getSystemUrl("shenqisettlement_iapi"), opurl, "POST",
				"JSON");
	}

	@Override
	public void addDefHeader() {
		client.addHeader("Accept",
				"text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public int getRetultCode() {

		int resultCode = 0;
		
		try {
			resultCode = new JSONObject(getReturnData()).getInt("resultCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return resultCode;
	}
	
	public String getResultMessage() {

		String msg = "";
		
		try {
			msg = new JSONObject(getReturnData()).getString("resultMessage");
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return msg;
	}

	public boolean isSuccess() {
		
		boolean success = false;
		
		try {
			success = new JSONObject(getReturnData()).getBoolean("success");
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return success;
	}
}